package com.jsgt.greekfire.ui.home.menu.pool

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jsgt.greekfire.R
import com.jsgt.greekfire.bean.PoolOrderBean
import java.math.BigDecimal

class PoolJoinOrderAdapter() :
    BaseQuickAdapter<PoolOrderBean, BaseViewHolder>(R.layout.item_pool_join_order) {

    init {
        addChildClickViewIds(R.id.txvCancel)
    }

    override fun convert(holder: BaseViewHolder, item: PoolOrderBean) {
        val bigDecimal1 = BigDecimal(item.money)
            .setScale(4, BigDecimal.ROUND_HALF_DOWN)

        val bigDecimal = BigDecimal(item.proportion)
            .multiply(BigDecimal(item.days))
            .multiply(BigDecimal(item.money))
            .setScale(4, BigDecimal.ROUND_HALF_DOWN)


        holder.setText(R.id.txvTime, item.createTime)
            .setText(R.id.txvAmount, bigDecimal1.toPlainString())
            .setText(R.id.txvIncome, bigDecimal.toPlainString())

    }
}